package 泛型;

import java.util.ArrayList;

public class 通配符 {
    public static void main(String[] args) {
        ArrayList<old> a=new ArrayList<>();
        a.add(new old());
        a.add(new old());
        a.add(new old());
        go(a);
        ArrayList<young> b=new ArrayList<>();
        b.add(new young());
        b.add(new young());
        b.add(new young());
        go(b);
        ArrayList<dog> c=new ArrayList<>();
        c.add(new dog());
        //go(c);报错因为规定了是man或者man的子类
    }
    public static void go(ArrayList<? extends man> a){

    }
}
class man{

}
class old extends man{

}
class young extends man{

}
class dog{

}
